/**
 * Created by Sunlight on 2017/11/8.
 */
define([
    'angular',
    'config',
    'constants',
    'common/api/gold.finder',
    'common/api/gold.products'
], function (angular, config, constants) {
    angular.module('gold', [
        'gold.finder',
        'gold.products'
    ])
        .factory('$$gold', ['$q', '$http', '$timeout', '$interval',
            '$rootScope', '$$finder', '$$products',
            function ($q, $http, $timeout, $interval,
                      $rootScope,  $$finder, $$products
                      ) {
                return {
                    $finder: $$finder,
                    $products: $$products,
                    start: function () {
                        var tasks = [];
                        $q.all(tasks).then(
                            function () {
                                $rootScope.$emit(constants.EVENTS.APP_READY);
                            }
                        );
                    },
                    //各种列表查询
                    find: function (target, keyWords, pagination, options) {
                        $$finder.find(target, keyWords, pagination, options);
                    }
                };
            }]);
});